var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, n) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var n in t)
              Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
          })(t, n);
      };
      return function (t, n) {
        function a() {
          this.constructor = t;
        }
        if ("function" != typeof n && null !== n)
          throw new TypeError(
            "Class extends value " + String(n) + " is not a constructor or null"
          );
        e(t, n),
          (t.prototype =
            null === n
              ? Object.create(n)
              : ((a.prototype = n.prototype), new a()));
      };
    })(),
  ComboBox = Laya.ComboBox,
  AXFlyMarketView = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.skin = "comp/button.png"),
        (t.loadSearchPropsFn = {
          caller: t,
          code: 1309,
          method: function (e) {
            var n = e.list;
            (t.marketArr = n), (t.flyArr = []), t.list_flymarket.scrollTo(0);
            for (var a, o = 0; o < n.length; o++)
              (a = {
                lbl_flyIndex: { text: o + 1 },
                lbl_boothName: n[o].name + "  " + n[o].money + " 银两",
                flyID: n[o].role_id,
              }),
                t.flyArr.push(a);
            t.list_flymarket.array = t.flyArr;
          },
        }),
        (t.onCheTanOperationFn = {
          caller: t,
          code: 1307,
          method: function (e) {
            0 == e.code &&
              (ToastView.toastView("撤摊成功！"),
              WebSocketService.send({ c: 1264, d: { type: 0, pageNum: 0 } }),
              (t.btn_myFlyMarket.visible = !1),
              (t.btn_fly_baitan.visible = !0),
              (t.btn_fly_chetan.visible = !1));
          },
        }),
        (t.requestMySelfMarketFn = {
          caller: t,
          code: 1311,
          method: function (e) {
            0 != e.code
              ? ((t.btn_myFlyMarket.visible = !1),
                (t.btn_fly_baitan.visible = !0),
                (t.btn_fly_chetan.visible = !1))
              : ((t.btn_myFlyMarket.visible = !0),
                (t.btn_fly_baitan.visible = !1),
                (t.btn_fly_chetan.visible = !!e.data.state));
          },
        }),
        (t.onCreateTanWeiFn = {
          caller: t,
          code: 1306,
          method: function (e) {
            if (0 == e.code && void 0 == e.msg) {
              var n = t.tab_flyFunction.selectedIndex + 1 + "",
                a = AXFlyMyMarketView.openModifyView("my", null, n);
              a.pos(0, 35), Laya.stage.addChild(a);
            } else ToastView.toastView, ToastView.toastView(e.msg);
          },
        }),
        (t.requestFlyMarketDataFn = {
          caller: t,
          code: 1264,
          method: function (e) {
            if (0 == e.code) {
              var n = e.list;
              (t.marketArr = n), (t.flyArr = []);
              for (var a, o = 0; o < n.length; o++)
                (a =
                  0 == t.fly_type
                    ? {
                        lbl_flyIndex: { text: o + 1 },
                        lbl_boothName: n[o].name,
                        flyID: n[o].role_id,
                      }
                    : {
                        lbl_flyIndex: { text: o + 1 },
                        lbl_boothName: n[o].name + "  " + n[o].money + " 银两",
                        flyID: n[o].role_id,
                      }),
                  t.flyArr.push(a);
              t.list_flymarket.array = t.flyArr;
            } else ToastView.toastView(e.msg);
          },
        }),
        t.btn_flymarketBack.on(Laya.Event.CLICK, t, t.onFlyMarketBackFn),
        t.tab_flyFunction.on(Laya.Event.CLICK, t, t.onTabFlyFuction),
        t.btn_myFlyMarket.on(Laya.Event.CLICK, t, t.onChaKanMyMarketDidClickFn),
        t.btn_fly_baitan.on(Laya.Event.CLICK, t, t.onFlyMarketDidClickFn),
        t.btn_fly_chetan.on(Laya.Event.CLICK, t, t.onFlyMarketCheTanFn),
        t.btn_saleHistory.on(Laya.Event.CLICK, t, t.onSaleHistoryFn),
        t.btn_searchprops.on(Laya.Event.CLICK, t, t.onSearchPropsFn),
        WebSocketService.addListener(t.requestFlyMarketDataFn),
        WebSocketService.addListener(t.requestMySelfMarketFn),
        (t.list_flymarket.vScrollBarSkin = ""),
        (t.list_flymarket.selectEnable = !0),
        t.list_flymarket.on(Laya.Event.CLICK, t, t.onMyFlyMarketnFuntion),
        WebSocketService.addListener(t.onCreateTanWeiFn),
        WebSocketService.addListener(t.onCheTanOperationFn),
        WebSocketService.addListener(t.loadSearchPropsFn),
        t
      );
    }
    return (
      __extends(t, e),
      (t.openFlyMarketView = function () {
        return (
          null == this.flyMarketVC && (this.flyMarketVC = new t()),
          WebSocketService.send({ c: 1264, d: { type: 0, pageNum: 0 } }),
          WebSocketService.send({ c: 1311, d: null }),
          (this.flyMarketVC.fly_type = 0),
          (this.flyMarketVC.tab_flyFunction.selectedIndex = -1),
          this.flyMarketVC
        );
      }),
      (t.prototype.onSearchPropsFn = function () {
        this.text_flymarket.text.length > 0
          ? WebSocketService.send({
              c: 1309,
              d: { value: this.text_flymarket.text },
            })
          : ToastView.toastView("请输入要搜索的内容！");
      }),
      (t.prototype.onSaleHistoryFn = function () {
        AXMarketRechargesView.showMarketChargesView();
      }),
      (t.prototype.onMyFlyMarketnFuntion = function (e) {
        if ("" != e.target.name) {
          var t = this.flyArr[this.list_flymarket.selectedIndex].flyID,
            n = AXFlyMyMarketView.openModifyView("other", t);
          n.pos(0, 35), Laya.stage.addChild(n);
        }
      }),
      (t.prototype.onFlyMarketDidClickFn = function () {
        WebSocketService.send({ c: 1306, d: null });
      }),
      (t.prototype.onFlyMarketCheTanFn = function () {
        NormalDialog.showNormalDialog(
          "您确定要撤销摊位吗？",
          this,
          this.onLevalMarketAction
        );
      }),
      (t.prototype.onLevalMarketAction = function () {
        WebSocketService.send({ c: 1307, d: null });
      }),
      (t.prototype.onChaKanMyMarketDidClickFn = function () {
        var e = Global.roleId,
          t = this.tab_flyFunction.selectedIndex + 1 + "",
          n = AXFlyMyMarketView.openModifyView("my", e, t);
        n.pos(0, 35), Laya.stage.addChild(n);
      }),
      (t.prototype.onTabFlyFuction = function (e) {
        "item0" == e.target.name
          ? (this.fly_type = 1)
          : "item1" == e.target.name
          ? (this.fly_type = 2)
          : "item2" == e.target.name
          ? (this.fly_type = 3)
          : "item3" == e.target.name
          ? (this.fly_type = 4)
          : "item4" == e.target.name
          ? (this.fly_type = 5)
          : "item5" == e.target.name && (this.fly_type = 6),
          WebSocketService.send({
            c: 1264,
            d: { type: this.fly_type, pageNum: 0 },
          });
      }),
      (t.prototype.onFlyMarketBackFn = function () {
        this.removeSelf();
      }),
      t
    );
  })(ui.MarketController.AXFlyMarketUI);
